const express = require('express');
const app = express();

app.use((request, repsonse, next) => {
    console.log("有人请求服务3了");
    next();
});

app.get("/students", (request, response) => {
    const students = [
        { id: "001", name: "tom", age: 18 },
        { id: "002", name: "jerry", age: 20 },
        { id: "003", name: "jack", age: 22 },
        { id: "004", name: "rose", age: 19 }
    ];
    response.send(students);
})

app.listen(5003, (err) => {
    if (!err) console.log("服务器2启动成功了，请求地址为：http://localhost:5003/students");
    else console.log(err);
})